package net.orange.console.model.analyzer;

import java.util.Comparator;

/**
 * The comparator for the analyse data key.
 * 
 */
public class AnalyseDataKeyComparator implements Comparator {

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	public int compare(Object arg0, Object arg1) {

		if (arg0 == null && arg1 != null)
			return 0;

		if (arg0 != null && arg1 == null)
			return 1;

		if (arg0 instanceof AnalyseDataKeyPair
				&& arg1 instanceof AnalyseDataKeyPair
				&& (arg0 != null && arg1 != null)) {

			return ((AnalyseDataKeyPair) arg0)
					.compareTo((AnalyseDataKeyPair) arg1);
		}
		return 0;
	}
}
